package main

import (
	"fmt"
	"vector/control/websocket"
	"vector/tools"
	_ "vector/tools"
)

func init() {
	tools.Config.ReadConfig()
}

func main() {

	runData := []map[string]any{
		{
			"省份": "安徽",
			"意图": "网龄成长计划",
			"问题": "我的成长值是几级？",
		},
	}
	var sessionId string
	for _, itemInfo := range runData {
		itemInfo["sessionId"] = sessionId
		t := new(websocket.AICanvas)
		err := t.NewTaskData(itemInfo)
		if err != nil {
			panic(err)
		}
		t.Do()
		for _, item := range t.Result()["child"].([]map[string]any) {
			for _, v := range []string{"问题", "回复", "气泡", "卡片", "状态", "备注", "sessionId", "traceId"} {
				fmt.Println(v, item[v])
				if v == "sessionId" {
					sessionId = item[v].(string)
				}
			}
			fmt.Println("-------------------------------")
		}

		// 更新上轮意图 和 sessionId
		tools.Config.AiCanvas.UpdateBody(map[string]string{"lastIntentName": "权益推荐"})
		fmt.Println("\n")
	}

}
